/**
 * 
 */
package woogieunit;


/**
 * @author cestus
 *
 */
public class BenchmarkFailure extends BenchmarkResult {
	private Throwable causeOfFailure;
	public BenchmarkFailure(){
		super();
	}
	public BenchmarkFailure(Throwable t){
		super();
		causeOfFailure = t;
	}
	public BenchmarkFailure(Throwable t, long timeResult, String benchmarkName, String benchmarkSuite, int benchmarkIteration, int benchmarkSuiteIteration) {
		super(timeResult, benchmarkName, benchmarkSuite, benchmarkIteration, benchmarkSuiteIteration);
		causeOfFailure = t;
	}
	public Throwable getCauseOfFailure(){
		return causeOfFailure;
	}
	public void setCauseOfFailure(Throwable t){
		causeOfFailure = t;
	}
	@Override
	public String toString(){
		if (getBenchmarkSuite() != null){
			return "FAILURE! From suite: " + getBenchmarkSuite() + ", iteration " + getBenchmarkSuiteIteration() + 
				". Benchmark: " + getBenchmarkName() + ", iteration " + getBenchmarkIteration() + 
				". Cause: " + causeOfFailure.getMessage();
		}
		else{
			return "FAILURE! Benchmark: " + getBenchmarkName() + ", iteration " + getBenchmarkIteration() + 
			". Cause: " + causeOfFailure.getMessage();
		}
	}
}
